/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.ufba.lasid.v1.jitclouds.mda.utils;

import br.ufba.lasid.v1.jitclouds.mda.MDA;

/**
 *
 * @author aliriosa
 */
/**
 *
 * @author aliriosa
 */
public class Shell{
   
    public static int execute(boolean exec, String ... args) throws Exception{
        String s = "";
        String more = "";

        for(int i = 0; i <args.length; i++){
            s += more + args[i];
            more = " ";
        }

        MDA.debug("executing the command '" + s + "'");

        if(exec){
            Runtime.getRuntime().exec(s);        
        }

        return 0;
        
    }
    
    public static int execute(String ... args) throws Exception{        
        return Shell.execute(MDA.ShellExecute, args);
                               
    }
        
}
